<template>
    <sub-box v-loading="loading">
        <breadcrumb :title="'历史版本'"></breadcrumb>
        <div class="white-block mt20" v-if="detail">
            <table-example :data="detail.resList" :tableColumn="header" class="mt20">
            </table-example>
        </div>
        <div class="box-th white-block mt20" v-if="detail">
            <div class="form-common clearfix">
                <div class="form-item">
                    <div class="form-item-label">绑定应用</div>
                    <div class="form-item-content">
                        <div v-for="(list,index) in detail.appList" :key="index">
                            <div>{{list.appName}}</div>
                            <div>
                                唯一代码：{{list.appCode}};
                                IP地址：{{list.ipList.join(', ')}}
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-item">
                    <div class="form-item-label">申请机构</div>
                    <div class="form-item-content">{{detail.deptName}}</div>
                </div>
                <div class="form-item">
                    <div class="form-item-label">申请人</div>
                    <div class="form-item-content">{{detail.userName}}</div>
                </div>
                <div class="form-item">
                    <div class="form-item-label">联系人</div>
                    <div class="form-item-content">{{detail.contactName}}</div>
                </div>
                <div class="form-item">
                    <div class="form-item-label">联系电话</div>
                    <div class="form-item-content">{{detail.contactTel}}</div>
                </div>
                <div class="form-item">
                    <div class="form-item-label">申请说明</div>
                    <div class="form-item-content">{{detail.remark}}</div>
                </div>
                <div class="form-item">
                    <div class="form-item-label">相关文件</div>
                    <div class="form-item-content">
                        <div v-for="(list,index) in detail.enclosures" :key="index">
                            <i class="el-icon-document"></i>{{list.fileName}}
                            <a :href="list.path" target="_blank" class="ml20">
                                <el-button type="primary" size="mini">下载</el-button>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </sub-box>
</template>

<script>
    import subBox from '../../components/layout/layout-sub'
    import breadcrumb from '../../components/breadcrumb'
    import tableExample from '../../components/table'

    export default {
        data() {
            return {
                header: [
                    {
                        prop: 'name',
                        label: '姓名',
                        minWidth: '50%',
                        align: 'center'
                    },
                    {
                        prop: 'resSource',
                        label: '提供单位',
                        minWidth: '50%',
                        align: 'center'
                    }
                ],
                versionNo: '',
                orderNo: '',
                detail: null,
                loading: false
            }
        },
        mounted() {
            if (this.$route.query.versionNo) this.versionNo = this.$route.query.versionNo
            if (this.$route.query.orderNo) this.orderNo = this.$route.query.orderNo
            this.getDetail()
        },
        methods: {
            getDetail() {
                this.loading = true
                this.$http.get('/gsOrder/getVersionOrderInfo', {
                    versionNo: this.versionNo,
                    orderNo: this.orderNo
                }).then(result => {
                    this.loading = false
                    if (result.success) {
                        this.detail = result.data
                    }
                    this.$method.updateView(false, true)
                }).catch(() => {
                    this.loading = false
                })
            }
        },
        components: {
            breadcrumb,
            tableExample,
            subBox
        }
    }
</script>
<style scoped lang="less">
    .box-th {

        .title {
            overflow: hidden;
            line-height: .3rem;

            span {
                padding: .1rem;
                float: left;
                color: #999;
                font-size: .16rem;
            }

            .p {
                float: left;
                margin-left: .4rem;
                font-size: .16rem;
                padding: .1rem;
            }

            .people {
                margin-left: .6rem;

            }

            .btn {
                border-radius: 0;
                margin-left: .2rem;
            }
        }

    }
</style>
